
TARGET		:= $(shell basename $(CURDIR))

OPTIMIZE	:= -O2 -fomit-frame-pointer -ffast-math
CFLAGS		:= -Wall -pipe -O2 -g -fbounds-check -fomit-frame-pointer -ffast-math

SRCS		:= $(foreach DIR, ., $(wildcard $(DIR)/*.c))

OBJS		:= $(SRCS:.c=.o)		# object files

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o : %.cpp
	$(CXX) $(CFLAGS) -c $< -o $@

all : $(TARGET)

$(TARGET) : $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^

clean :
	rm -f $(TARGET) $(OBJS)

